home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Security
/
Ashampoo AntiVirus 1.61
/
ashampoo_antivirus161_sm.exe
/
{app}
/
AshAV.gadget
/
js
/
settings.js
< prev
Wrap
Text (UTF-16)
|
2007-08-29
|
18KB
|
293 lines
//AV Gadget
//<C> 2007 Ashampoo GmbH & Co K.G.
var mySetting = new clockSettings();
var L_PREVIOUS_TEXT = "Previous";
var L_NEXT_TEXT = "Next";
var imagePath = "images/";
var imageArray = new Array("bg_progress_empty.png");
var imageIndex = 0;
var oShell = new ActiveXObject("WScript.Shell");
var stxt1="", stxt2="", stxt3="", stxt4="", stxt5="", stxt6="", stxt7="";
//////var bChk1,bChk2,bChk3,bChk4,bChk5,bChk6;
var scanaction = 4;
////////////////////////////////////////////////////////////////////////////////
// load settings
////////////////////////////////////////////////////////////////////////////////
function loadSettings()
{
var pageDir = document.getElementsByTagName("html")[0].dir;
if (pageDir == "rtl")
{
settingsButtonTable.dir = "rtl";
var temp = settingsButtonLeftCell.innerHTML;
settingsButtonLeftCell.innerHTML = settingsButtonRightCell.innerHTML;
settingsButtonRightCell.innerHTML = temp;
temp = settingsImageLeft.onmousedown;
settingsImageLeft.onmousedown = settingsImageRight.onmousedown;
settingsImageRight.onmousedown = temp;
temp = settingsLeftAnchor.onkeypress;
settingsLeftAnchor.onkeypress = settingsRightAnchor.onkeypress;
settingsRightAnchor.onkeypress = temp;
settingsImageLeft.alt = L_NEXT_TEXT;
settingsImageRight.alt = L_PREVIOUS_TEXT;
}
else
{
settingsImageLeft.alt = L_PREVIOUS_TEXT;
settingsImageRight.alt = L_NEXT_TEXT;
}
var lm = "HKLM\\Software\\Ashampoo\\Ashampoo AntiVirus\\";
var text1="", text2="", text3="", text4="", text5="", text6="";
var gtxt1="", gtxt2="", gtxt3="";
//Set texts according to language choosen (ashavsrv.exe conveniently writes them in the registry)
try
{
text1 = oShell.RegRead(lm + "gOption1");
text2 = oShell.RegRead(lm + "gOption2");
text3 = oShell.RegRead(lm + "gOption3");
text4 = oShell.RegRead(lm + "gOption4");
text5 = oShell.RegRead(lm + "gOption5");
text6 = oShell.RegRead(lm + "gOption6");
gtxt1 = oShell.RegRead(lm + "gText1");
gtxt2 = oShell.RegRead(lm + "gText2");
gtxt3 = oShell.RegRead(lm + "gText3");
}
catch(err) { }
try
{
stxt1 = oShell.RegRead(lm + "gScan1");
stxt2 = oShell.RegRead(lm + "gScan2");
stxt3 = oShell.RegRead(lm + "gScan3");
stxt4 = oShell.RegRead(lm + "gScan4");
stxt5 = oShell.RegRead(lm + "gScan5");
stxt6 = oShell.RegRead(lm + "gScan6");
stxt7 = oShell.RegRead(lm + "gScan7");
loadActions();
}
catch(err)
{
stxt1 = "Scan Removables";
stxt2 = "Scan Memory";
stxt3 = "Scan System Areas"
stxt4 = "Scan Entire System";
stxt5 = "Scan Hard Drives";
stxt6 = "Scan CDs/DVDs";
stxt7 = "Scan Folders";
loadActions();
}
mySetting.load();
imageIndex = mySetting.themeID;
settingsUpdateIndex();
scanActionIndex.value = scanaction;
this.chk1.checked = mySetting.bChk1;
this.chk2.checked = mySetting.bChk2;
this.chk3.checked = mySetting.bChk3;
this.chk4.checked = mySetting.bChk4;
this.chk5.checked = mySetting.bChk5;
this.chk6.checked = mySetting.bChk6;
gOpt1.innerText = text1;
gOpt2.innerText = text2;
gOpt3.innerText = text3;
gOpt4.innerText = text4;
gOpt5.innerText = text5;
gOpt6.innerText = text6;
gText1.innerText = gtxt1;
gText2.innerText = gtxt2;
gText3.innerText = gtxt3 + " ";
System.Gadget.onSettingsClosing = settingsClosing;
}
function settingsUpdateImage(img, state)
{
img.src = imagePath + "settings_" + img.src.split("_")[1] + "_" + state + ".png";
}
function settingsButtonBack()
{
if (event.keyCode == 32 || event.button == 1)
{
imageIndex--;
if (imageIndex < 0)
{
imageIndex = imageArray.length - 1;
}
settingsUpdateIndex();
}
}
function settingsButtonForward()
{
if (event.keyCode == 32 || event.button == 1)
{
imageIndex++;
if (imageIndex == imageArray.length)
{
imageIndex = 0;
}
settingsUpdateIndex();
}
}
function settingsUpdateIndex()
{
mySetting.themeID = imageIndex;
settingsImagePreview.src = imagePath + imageArray[imageIndex];
currentIndex.innerHTML = imageIndex + 1;
maxIndex.innerHTML = imageArray.length;
}
////////////////////////////////////////////////////////////////////////////////
// settings event closing
////////////////////////////////////////////////////////////////////////////////
function settingsClosing(event)
{
if (event.closeAction == event.Action.commit)
{
saveSettings();
}
}
////////////////////////////////////////////////////////////////////////////////
// create object
////////////////////////////////////////////////////////////////////////////////
function clockSettings()
{
this.save = saveSettingToDisk;
this.load = loadSettingFromDisk;
this.themeID = 0;
this.scanActionIndex = 4;
scanaction = 4;
this.bChk1 = true;
this.bChk2 = true;
this.bChk3 = true;
this.bChk4 = true;
this.bChk5 = true;
this.bChk6 = true;
}
////////////////////////////////////////////////////////////////////////////////
// load the information from disk
////////////////////////////////////////////////////////////////////////////////
function loadSettingFromDisk()
{
if (System.Gadget.Settings.read("SettingsExist"))
{
this.themeID = parseInt(System.Gadget.Settings.read("themeID"));
scanaction = parseInt(System.Gadget.Settings.read("scanActionIndex"));
this.bChk1 = System.Gadget.Settings.read("chk1");
this.bChk2 = System.Gadget.Settings.read("chk2");
this.bChk3 = System.Gadget.Settings.read("chk3");
this.bChk4 = System.Gadget.Settings.read("chk4");
this.bChk5 = System.Gadget.Settings.read("chk5");
this.bChk6 = System.Gadget.Settings.read("chk6");
}
}
////////////////////////////////////////////////////////////////////////////////
// save information to disk
////////////////////////////////////////////////////////////////////////////////
function saveSettingToDisk()
{
System.Gadget.Settings.write("SettingsExist", true);
System.Gadget.Settings.write("themeID", this.themeID);
System.Gadget.Settings.write("scanActionIndex", this.scanActionIndex.value);
System.Gadget.Settings.write("chk1", this.bChk1);
System.Gadget.Settings.write("chk2", this.bChk2);
System.Gadget.Settings.write("chk3", this.bChk3);
System.Gadget.Settings.write("chk4", this.bChk4);
System.Gadget.Settings.write("chk5", this.bChk5);
System.Gadget.Settings.write("chk6", this.bChk6);
}
////////////////////////////////////////////////////////////////////////////////
// save settings
////////////////////////////////////////////////////////////////////////////////
function saveSettings()
{
mySetting.scanActionIndex = scanActionIndex;
mySetting.bChk1 = this.chk1.checked;
mySetting.bChk2 = this.chk2.checked;
mySetting.bChk3 = this.chk3.checked;
mySetting.bChk4 = this.chk4.checked;
mySetting.bChk5 = this.chk5.checked;
mySetting.bChk6 = this.chk6.checked;
mySetting.save();
}
///////////////////////////////////////////////////////////////////////////////
// load Actions
////////////////////////////////////////////////////////////////////////////////
function loadActions()
{
scanActionIndex.options[0] = new Option(stxt1, "1");
scanActionIndex.options[1] = new Option(stxt2, "2");
scanActionIndex.options[2] = new Option(stxt3, "3");
scanActionIndex.options[3] = new Option(stxt4, "4");
scanActionIndex.options[4] = new Option(stxt5, "5");
scanActionIndex.options[5] = new Option(stxt6, "6");
scanActionIndex.options[6] = new Option(stxt7, "7");
}
////////////////////////////////////////////////////////////////////////////////
//
// trim white space
//
////////////////////////////////////////////////////////////////////////////////
function trim(stringIn, removeFrom)
{
var stringOut = "";
stringIn = stringIn.toString();
if (stringIn.length > 0)
{
switch (removeFrom)
{
case "left":
stringOut = stringIn.replace(/^\s+/g, "");
break;
case "right":
stringOut = stringIn.replace(/\s+$/g, "");
break;
case "both":
default:
stringOut = stringIn.replace(/^\s+|\s+$/g, "");
}
}
return stringOut;
}